package com.lb.web;

import com.lb.entity.User;
import com.lb.service.UserService;
import com.lb.utils.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 功能描述: 用户控制器<br>
 * @Author: Edward
 * @Date: 2021/7/3 15:07
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/save")
    public R insertUser(@RequestBody User user) {
        return userService.savePeople(user);
    }

    @PostMapping("/saveToAdmin")
    public R savePeopleToAdmin(@RequestBody User user) {
        return userService.savePeopleToAdmin(user);
    }

    @PostMapping("/saveToDefault")
    public R savePeopleToDefault(@RequestBody User user) {
        return userService.savePeopleToDefault(user);
    }

    /**
     * 功能描述: <br>
     * @param user
     * @Author: Edward
     * @Date: 2021/7/7 9:24
     */
    @PostMapping("/saveLog")
    public R test(@RequestBody User user) {
        return userService.test(user);
    }

}